package com.neusoft.neuiotms.dcam.fixed.repository.impl;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.neusoft.bizcore.web.jpa.repository.AbstractRepository;
import com.neusoft.bizcore.web.support.Searchable;
import com.neusoft.neuiotms.dcam.fixed.model.MachinePartsBind;
import com.neusoft.neuiotms.dcam.fixed.model.QMachinePartsBind;
import com.neusoft.neuiotms.dcam.fixed.repository.CustomizedPartsBindRepository;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.jpa.impl.JPAQuery;

public class CustomizedPartsBindRepositoryImpl extends AbstractRepository
        implements CustomizedPartsBindRepository {

    @Override
    public Page<MachinePartsBind> search(final Pageable pageable, final Searchable searchable) {
        final QMachinePartsBind qGoodsFile = QMachinePartsBind.machinePartsBind;
        final BooleanBuilder where = this.buildWhere(searchable);
        final JPAQuery<MachinePartsBind> query = this.query().selectFrom(qGoodsFile);
        query.where(where);
        return super.search(query, pageable);
    }

    @Override
    protected Class<?> getModelClass() {
        return MachinePartsBind.class;
    }

    private BooleanBuilder buildWhere(final Searchable searchable) {
        final BooleanBuilder where = new BooleanBuilder();
        return where;
    }

}
